package com.boot.system.entity;

import com.boot.common.entity.BaseEntity;
import com.boot.system.entity.listener.UserOnSetListener;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Table;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.util.List;

/**
 * 系统用户
 */
@Getter
@Setter
@Accessors(chain = true)
@Table(value = "sys_user", onSet = UserOnSetListener.class)
public class SysUser extends BaseEntity {

    /**
     * 父ID
     */
    @Column(value = "pid")
    private Long pid;

    /**
     * 父节点树目录
     */
    @Column(value = "tree_path")
    private String treePath;

    /**
     * 用户名
     */
    @Column(value = "username")
    private String username;

    /**
     * 密码
     */
    @Column(value = "password")
    private String password;

    /**
     * 头像
     */
    @Column(value = "avatar")
    private String avatar;

    /**
     * 昵称
     */
    @Column(value = "nickname")
    private String nickname;

    /**
     * 性别
     * 1-男 2-女 0-保密
     */
    @Column(value = "gender")
    private Integer gender;

    /**
     * 邮箱
     */
    @Column(value = "email")
    private String email;

    /**
     * 手机号
     */
    @Column(value = "phone")
    private String phone;

    /**
     * 个人简介
     */
    @Column(value = "bio")
    private String bio;

    /**
     * 角色字符串
     */
    @Column(value = "roles")
    private String roles;

    /**
     * 角色数组
     */
    @Column(ignore = true)
    private String[] roleArr;

    /**
     * 部门ID
     */
    @Column(value = "dept_id")
    private Long deptId;

    /**
     * 部门名称
     */
    @Column(ignore = true)
    private String deptName;

    /**
     * 部门树目录
     */
    @Column(value = "dept_tree_path")
    private String deptTreePath;

    /**
     * 用户状态
     * 1=正常 0=停用
     */
    @Column(value = "status")
    private Integer status;

    /**
     * 最后登录时间
     */
    @Column(value = "login_time")
    private Long loginTime;

    /**
     * 最后登录IP
     */
    @Column(value = "login_ip")
    private String loginIp;

    /**
     * 子节点
     */
    @Column(ignore = true)
    private List<SysUser> children;
}
